<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>登陆界面</title>   
    <link rel ="stylesheet" type ="text/css" href="<%=request.getContextPath()%>/css/login.css" />

  <script type="text/javascript">
     function checkLogin(){
        //得到输入框的内容
        var name =document.getElementById("username").value;
        var pwd =document.getElementById("userpwd").value;    
        
        //得到div对象
        //var div_name =document.getElementsById("userName");
        //alert(div_name);
        if(name==""){
          // alert("用户名不能为空！！");
         //  document.getElementById(”ID”).innerHTML 
           div_name.innerText="用户名不能为空！！";
           return false;
        }       
        if(name.length<6||name.length>20){
           alert("用户名要在6~20之间！！");
           return false;
        }
        
        if(pwd==""){
           alert("密码不能为空！！");
           return false;
        }       
        if(pwd.length<6||pwd.length>20){
           alert("密码要在6~20之间！！");
           return false;
        }
        
        return true;     
     } 
  </script>

  </head>
  
  <body>
     <div id="container">
         <div id="front">    
           <jsp:include page="front.jsp" />                              
	    </div> 
	    
	    <div id="main">		               
	       <div id="center">
	       <form action="login.cn" method="POST" onsubmit="return checkLogin();"><center>
	           <div class="infor">
		            <table>
		               <tr>
		                 <td>用户名:</td>
		                 <td><input class="input-style" type="text" name="username" id="username" /></td>
		                 <td><div id="userName"></div></td>
		               </tr>
		               <tr>
		                 <td>密&nbsp;&nbsp;码:</td>
		                 <td><input class="input-style" type="password" name="userpwd" id="userpwd" /></td>
		                 <td><div id="userpwd"></div></td>
		               </tr>
		               <tr>
		                 <td>验证码:</td>
		                 <td><input class="input-style" type="text" name="code" /></td>
		                 <td></td>
		               </tr>
		               <tr>
		                 <td></td>
		                 <td><img src="image.cn" /><a href="JSP/blogjsp/login.jsp">看不清</a></td>
		                 <td></td>
		               </tr>
		               <tr>
		                 <td></td>
		                 <td><input type="submit" value="登陆" /><a href="JSP/blogjsp/regis.jsp">注册新用户</a></td>
		                 <td></td>
		               </tr>
		            </table>    		                                 
		       </div>	
		       </center>                      	              	              	             	              	        
	       </form>
	       </div>	      
	    </div>
        
        
         <jsp:include page="../footer.jsp"></jsp:include>
     </div>
  </body>
</html>
